﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
using System.Text;

namespace EzyGoEzySystem.Services
{
    /// <summary>
    /// Encrypt sensitive information
    /// </summary>
    public static class Encryptor
    {
        /// <summary>
        /// Encrypt the given string
        /// TODO: implement the encryption using some algorithm
        /// </summary>
        /// <param name="password"></param>
        /// <returns></returns>
        public static string Encrypt(string message)
        {
            // encrypt the message using MD5
            using (var md5Hasher = new MD5CryptoServiceProvider())
            {
                var hashedDataBytes = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(message));
                return Convert.ToBase64String(hashedDataBytes);
            }
        }
    }
}